import { formatDate } from '@/utils'
export default {
  filters: {
    dateTime: function (timestr, fmt) {
      if (timestr) {
        return formatDate(new Date(timestr), fmt)
      }
    },
    sexTransfer: function (status) {
      return status ? '男' : '女'
    },
    imgResize: function (url, w, h) {
      if (url) {
        return `${url}?x-oss-process=image/resize,w_${w}` + (h ? `,h_${h}` : '')
      } else {
        return 'https://fdwebhost.oss-cn-huhehaote.aliyuncs.com/zhiyazhiyuan/images/placeholder.png'
      }
    },
    avatarImg: function (url, sex) {
      if (url) {
        return url
      } else {
        return sex ? 'https://fdwebhost.oss-cn-huhehaote.aliyuncs.com/zhiyazhiyuan/images/boy.png' : 'https://fdwebhost.oss-cn-huhehaote.aliyuncs.com/zhiyazhiyuan/images/girl.png'
      }
    }
  }
}
